<script type="text/javascript" >
    stPublishToolbox.sortColumn();
    stPublishToolbox.shortAction();
       jQuery(document).ready(function(){
//           jQuery("#helpBtn a[rel^='prettyPhoto']")
           jQuery("#link a[rel^='prettyPhoto']").prettyPhoto({theme:'facebook', keyboard_shortcuts: false});
           
        FB.init({
            appId:'<?php echo $config['facebook_app_id']; ?>', cookie:true,
            status:true, xfbml:true
        });
        <?php if($logoff == 'true'){?>
        <?php echo 'logoff();'; } else {?>
        FB.Event.subscribe('auth.sessionChange', function(response) {
            if (response.session) {
                var access_token = response.session.access_token;
                var session_key = response.session.session_key;
                var uid = response.session.uid;
                stPublishToolbox.loadPage("list_wall&access_token="+access_token+"&session_key="+session_key+"&uid="+uid+"&login=true", '', '', function(){
                    window.location = '<?php echo get_bloginfo('url'); ?>/wp-admin/admin.php?page=stPublishToolbox';
                });
            }

        });
<?php }?>
    });
    function logoff(){
        FB.getLoginStatus(function(response) {
            if (response.session) {
                FB.logout(function(response) {
                    stPublishToolbox.loadPage("list_wall&login=true", '', '', function(){
                        window.location = '<?php echo get_bloginfo('url'); ?>/wp-admin/admin.php?page=stPublishToolbox';
                    });
                });
            } else {
                stPublishToolbox.loadPage("list_wall&login=true", '', '', function(){
                    window.location = '<?php echo get_bloginfo('url'); ?>/wp-admin/admin.php?page=stPublishToolbox';
                });
            }
        });


    }
</script>
<div id="fb-root"></div>
<div class="w100p bgl">
    <div class="w100p bgr">
        <div class="inner_container">
            <center style="padding-top: 20px;padding-bottom: 20px;">
            <?php
            $check = 0;
            if ($option['access_token'] != '') {
                $name = json_decode(file_get_contents("https://graph.facebook.com/me?access_token=" . $option['access_token']))->name;
                if ($name != '') {
                    $check = 1;
                  
                }

            ?>
            <?php } ?>

        </center>
            <?php
            if($check != 1){
            ?>
            <style>
            .upcase a {
            display:none;
            }
            </style>
            <?php }?>
            <table class="widefat" cellspacing="0" <?php if($check != 1){echo 'style="display:none;"';}?>>
                <thead>
                    <tr>
                        <?php print_column_headers('stFacebookToolbox_stFacebookToolbox'); ?>
                    </tr>
                </thead>

                <tbody>
                <?php
                if (count($results) > 0) {
                    $tr_class = "";
                    $upload_data = wp_upload_dir();
                    foreach ($results as $result) {
                        if( empty($tr_class) || $tr_class == "class='bg_gray2'"){
                            $tr_class = "class='bg_gray1'";
                        }else{
                            $tr_class = "class='bg_gray2'";
                        }
                        echo "<tr id='$result->id' $tr_class >"
                        . "<td>" . $result->name
                        . "<div class=\"row-actions short_action\">";
                        if($result->published == 1)
                        echo "<span class='edit' action='edit_wall_publish' short_action='' id='$result->id'>Edit | </span>";
                        echo "<span class='trash' short_action='delete' id='$result->id' confirm='Are you sure you want to delete this wall publish ?'>Trash </span>"
                        . "</div>"
                        . "</td>"
                        . "<td>" . str_replace('swf','flash',$result->type) . "</td>"
                        . "<td>";
                        echo (strlen($result->content) > 25)?substr($result->content,0,25).'...':$result->content ;
                        echo "</td>"
                        . "<td>" ;
                        echo ($result->published == 1)?'pending':'published' ;
                        echo "</td>"
                       . "<td>" . $result->time . "</td>"
                        . "<td>" . $result->created_date . "</td>"
                        . "<td>" . $result->last_update . "</td>"
                        . "</tr>"
                        ;
                    }
                }
                ?>
                </tbody>
            </table>
            <div class="page_d">
                <?php echo $pagination?>
                <div class="cl"></div>
            </div>

        </div>
    </div>
</div>